package com.radiant.data.entity;

import javax.xml.bind.annotation.XmlRootElement;

import com.radiant.data.annotation.Entity;
import com.radiant.data.annotation.Persist;

@XmlRootElement
@Entity(name="Post")
public class Post extends WallEntity implements ActivityFeedable {

	@Persist(name="postId", itemName=true)
	private String postId;

	@Persist(name="message")
	private String message;

	@Persist(name="picture")
	private String picture;

	@Persist(name="userName")
	private String from;

	public Post() {
		
	}
	
	public String getPostId() {
		return postId;
	}

	public void setPostId(String postId) {
		this.postId = postId;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public void addToActivity(Activity activity) {
		activity.setPost(this);
	}

	public void addMessageToActivity(Activity activity, User creator,
			Child child) {
		StringBuffer sb = new StringBuffer();
		sb.append(creator.getUserName()).append(" added a new post");
		activity.setMessage(sb.toString());
	}
		
}
